﻿
Public Class ObraDal
    Dim db As dataBaseDataContext
    Sub New()
        Try
            db = New dataBaseDataContext(sqlConfiguracion.GetConnectionString)
        Catch ex As Exception

        End Try


    End Sub
    Sub nuevaObra(obraNueva As Obra)
        Try
            db.Obra.InsertOnSubmit(obraNueva)
            db.SubmitChanges()

        Catch ex As Exception

        End Try
        
    End Sub
    Function recuperar(obra As Obra) As Obra

        Try
            Dim o = (From ob In db.Obra Where ob Is obra Select ob).FirstOrDefault
            Return o
        Catch ex As Exception

        End Try

    End Function

    Function recuperar(nombre As String) As Obra
        Try
            Dim o = (From ob In db.Obra Where ob.Obra = nombre Select ob).FirstOrDefault
            Return o
        Catch ex As Exception

        End Try

    End Function

End Class
